/*
 * CanvasControl.h
 *
 *  Created on: 2013-1-26
 *      Author: heqiu
 */

#ifndef CANVASCONTROL_H_
#define CANVASCONTROL_H_

#include "Guud.h"
#include <map>
using namespace guud;
using namespace std;

void button_building_pressed(void * pData, GuudButton * pButton);

void button_building_icon_pressed(void * pData, GuudButton * pButton);
class CanvasControl: public GuudCanvas {
public:
	bool m_bListen_icon;
	GuudSurface m_GuudSurface_control;
	GuudSurface m_GuudSurface_building;
	GuudSurface m_GuudSurface_building_icon;

	GuudButton m_button_building;
	map<string, GuudBuilding *> m_map_button_building;
	map<string, GuudButton *> m_map_button_building_icon;
	string m_select_building;
	GuudBuilding * m_p_select_building;

	CanvasControl(uint32_t uiShortUnit, uint32_t uiLongUnit,
			uint32_t uiUnitPixel);
	~CanvasControl();
	void draw();
	void init();
	void handleEvent(GuudEvent &stEvent);
private:
	void initBuilding(GuudRect & rect, const char * pName);
	void initBuildingIcon(GuudRect & rect, const char * pName);
};

#endif /* CANVASCONTROL_H_ */
